<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/15
 * Time: 15:20
 */

namespace app\admin\controller;


use app\admin\logic\BusBusinessLogic;
use think\facade\Request;

class BusBusiness extends Base {

    private $busBusinessLogic;

    public function __construct()
    {
        parent::__construct();
        $this->busBusinessLogic = new BusBusinessLogic();
    }

    public function index(){
        return $this->fetch();
    }

    /**
     * 车方列表
     * @return \think\response\Json
     */
    public function ajaxIndex(){
        $tempWhere = Request::post();
        $res = $this->busBusinessLogic->busBusinessList($tempWhere, self::$nowPage);
        return json($res);
    }

    /**
     * 查看车方资料
     * @return mixed
     */
    public function add(){
        $businessId = Request::get('id');
        $act = 'add';
        if ($businessId){
            $info = $this->busBusinessLogic->busBusinessInfo($businessId);
            $act = 'edit';
            $this->assign('info', $info['data']);
        }
        $this->assign('act', $act);
        return $this->fetch();
    }

    public function audit(){

        return $this->fetch();
    }

    public function ajaxAudit(){
        $tempWhere = Request::post();
        $res = $this->busBusinessLogic->busBusinessAuditList($tempWhere, self::$nowPage);
        return json($res);
    }

    /**
     * 操作车方编辑
     */
    public function handle(){
        $data = Request::param();
        $res = $this->busBusinessLogic->handle($data);
        return json($res);
    }

}